

require("UIColor");

defineClass('ViewController', {
            handleBtn: function(sender) {
            var demoVC = OneViewController.alloc().init();
            self.navigationController().pushViewController_animated(demoVC, YES);
            }
            }, {});


require('UITableView,UIColor,UIImageView,UIImage,UITableViewCell,NSString');
defineClass('OneViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>',{
            
            viewDidLoad: function() {
            // super.viewDidLoad();
            
            self.view().setBackgroundColor(UIColor.redColor());
            
            var text = "这是测试js";
            
            console.log(text);
           
            var size = self.view().bounds();
             console.log(size.width);
            
            var table = UITableView.alloc().initWithFrame_style({x:0, y:64, width:size.width, height:(size.height - 64)}, 0);
            
            table.setDelegate(self);
            table.setDataSource(self);
            table.setBackgroundColor(UIColor.clearColor());
            self.view().addSubview(table);
            
            table.setBackgroundView(UIImageView.alloc().initWithImage(UIImage.imageNamed("demo.jpg")));


            },

            
            tableView_numberOfRowsInSection: function(tableView, section) {
                return 30;
            },

            
            tableView_cellForRowAtIndexPath: function(tableView, indexPath) {
            var cellIndef = "cellIndef";
            var cell = tableView.dequeueReusableCellWithIdentifier(cellIndef);
            if (!cell) {
                cell = UITableViewCell.alloc().initWithStyle_reuseIdrubyentifier(0, cellIndef);
                cell.setBackgroundColor(UIColor.clearColor());
            }
            
            cell.textLabel().setText(NSString.stringWithFormat("%zd", indexPath.row()));
            
            return cell;
           }
});
